package com.freedom.controller.w.core;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.freedom.bean.core.SysDistrict;
import com.freedom.service.core.SysDistrictService;
import com.freedom.util.sys.HtmlUtil;
import com.freedom.vo.w.core.WebVo;

/**
 * 区县
 * @author huguangjun
 *
 */
@Controller
public class SysDistrictController extends BaseWebPaginationCRUDController<WebVo> {

	private static final Logger logger = LoggerFactory.getLogger(SysDistrictController.class);

	@Override
	public String init() {
		// TODO Auto-generated method stub
		return null;
	}

	@Autowired
	private SysDistrictService sysDistrictService;

	@RequestMapping("wh006/1")
	public void getSysDistrictBycityId(@RequestParam String cityId, HttpServletResponse response) {
		Map<String,Object> map = new HashMap<String,Object>();
		List<SysDistrict> sysDistricts = null;
		try {
			map.put("cityId", cityId);
			sysDistricts = this.sysDistrictService.getSysDistrictByCityId(map);
		} catch (Exception e) {
			logger.error(e.toString());
		}
		HtmlUtil.writerJson(response, sysDistricts);
	}
}
